package br.unisul.prolinear.view;

import java.util.List;

import javax.faces.model.ListDataModel;

import org.primefaces.model.SelectableDataModel;

import br.unisul.prolinear.dao.DocumentoDao;
import br.unisul.prolinear.dao.DocumentoDaoImp;
import br.unisul.prolinear.model.Documento;

public class DocumentoDataModel extends ListDataModel<Documento> implements SelectableDataModel<Documento> {

	public DocumentoDataModel(List<Documento> data) {
		super(data);  
	}

	@Override
	public Documento getRowData(String rowKey) {
		DocumentoDao dao = new DocumentoDaoImp();
		return dao.getById(Long.parseLong(rowKey));
	}

	@Override
	public Object getRowKey(Documento arg0) {
		return arg0.getId();
	}

}
